<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../css/element.css" rel="stylesheet"/>
    <link href="../css/styleindex.css" rel="stylesheet"/>
    <style>

    </style>
</head>
<body style="background:#EFF0F4;">

  <div class="mui-content">
    <div id="vm" class="x-examok" v-cloak>
      <div class="x-header-g" id="header">
        <a class="x-header-arrow" @click="api.closeWin()"></a>
        <div class="x-header-t">{{headtitle}}-{{thgroupname}}</div>
      </div>
      <template>
        <el-table :data="tableData"  @cell-click='openpersonrecord'>
          <!-- <el-table-column label="序号" width="50"  type="index"></el-table-column> -->
          <el-table-column prop="username" label="姓名" width="" fixed></el-table-column>
          <el-table-column prop="in_date" :label="headtitletime" width=""></el-table-column>
          <el-table-column prop="work_length" label="工龄" width=""></el-table-column>
          <el-table-column prop="level_title" label="现职级"></el-table-column>
          <el-table-column label="查看档案" width="">
            <el-button type="text">查看</el-button>
          </el-table-column>
        </el-table>
      </template>
    </div>
  </div>

  <script type="text/javascript" src="../script/vue.js"></script>
  <script type="text/javascript" src="../script/element.js"></script>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript" src="../script/base.js"></script>
	<script>
apiready = function () {

    var tison = api.pageParam.ison;//1在职 2离职
    var tid = api.pageParam.id;
    var tmonth = api.pageParam.datemonth;
    var tgroupname = api.pageParam.groupname;
    var tshopid = api.pageParam.shopid;
    $api.fixStatusBar($api.byId('header'));
    var iostoph = api.safeArea.top+33+44;

    //
    var vm = new Vue({
      el:'#vm',
      data(){
        return{
          istype:'',
          isid:'',
          ismonth:'',
          tableData:[],
          headtitle:'',
          headtitletime:'',
          thgroupname:'',
          thshopid:'',
        }
      },
      created:function() {
        var that=this;


      },
      mounted:function(){
        var that=this;
        that.istype = tison;//
        that.isid = tid;//
        that.ismonth = tmonth;//
        that.thgroupname = tgroupname;//组
        that.thshopid = tshopid;
        if(that.istype=='1'){
          that.headtitle = '在职档案'
          that.headtitletime = '入职时间';
          that.getdata()
        }if(that.istype=='2'){
          that.headtitle = '离职档案'
          that.headtitletime = '离职时间';
          that.getdatatwo()
        }

      },
      methods: {
        //
        getdata:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/person/inworkGroupList',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                date:that.ismonth,
                deptid:that.isid,
                _ssid:that.thshopid
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.tableData = ret.data.list;

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        //
        getdatatwo:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/person/leaveGroupList',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                date:that.ismonth,
                deptid:that.isid,
                _ssid:that.thshopid
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.tableData = ret.data.list;

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        //打开个人档案
        openpersonrecord:function(val){
          console.log(JSON.stringify(val));
          var that=this;
          that.opentabs()
          that.openuseradminframegroup(val.id)
        },
        opentabs:function(){
          var that=this;
          api.openFrame({
            name:'personrecord',
            url:'./personrecord.html',
            bounces: false,
            rect: {
              marginLeft:0,
              marginTop:0,
              marginBottom:0,
              marginRight:0
            },
            pageParam: {
                istype:that.istype,
                fromhtmlname:'incardlist'
            }
          })
        },
        openuseradminframegroup:function(cid){
          console.log(cid);
          api.openFrameGroup({
              name: 'openpersonrecordgroup',
              background: '#fff',
              rect: {
                 marginLeft:0,
                 marginTop:iostoph,
                 marginBottom:0,
                 marginRight:0
              },
              frames: [{
                  name: 'newpro1',
                  url: './newpro1.html',
                  bgColor: '#fff',
                  bounces:false,
                  pageParam:{
                    id:cid,
                    isonlysee:true
                  }
              },  {
                  name: 'newpro2',
                  url: './newpro2.html',
                  bgColor: '#fff',
                  bounces:false,
                  pageParam:{
                    id:cid,
                    isonlysee:true
                  }
              },{
                  name: 'newpro3',
                  url: './newpro3.html',
                  bgColor: '#fff',
                  bounces:false,
                  pageParam:{
                    id:cid,
                    isonlysee:true
                  }
              }, {
                  name: 'newpro4',
                  url: './newpro4.html',
                  bgColor: '#fff',
                  bounces:true,
                  pageParam:{
                    id:cid,
                    isonlysee:true
                  }
              }, {
                  name: 'newpro5',
                  url: './newpro5.html',
                  bgColor: '#fff',
                  bounces:true,
                  pageParam:{
                    id:cid,
                    isonlysee:true
                  }
              }],
              preload:3,
              index:0,
              scrollEnabled:false//滑动
          }, function(ret, err) {
              if(ret){
                if (ret.index > -1) {
                  // setTimeout(function(){
                  //   api.execScript({
                  //       frameName: 'personrecord',
                  //       script: 'fnNvnsetSelected("' + ret.index + '");'
                  //   });
                  // },1000)

                }
              }
          });
        },
      }
    })
	}
  function fnsetFrameGroupIndex(name, index) {
      api.setFrameGroupIndex({
          name: name,
          index: index,
          scroll: true
      });
  }

	</script>
</body>
</html>
